package cn.xiaolang.event.spring;

import cn.xiaolang.event.CreateOrderMsg;
import org.junit.Test;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;


/**
 * 基于greenrobot/EventBus的EventBus做生产订阅
 *
 * @author Dean
 * @date 2021-05-18
 */
@ComponentScan("cn.xiaolang.event.spring")
public class EventBusSample {

    @Test
    public void test() {
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(EventBusSample.class);
        DnEventBusContext contextBean = context.getBean(DnEventBusContext.class);
        contextBean.eventPost(new CreateOrderMsg("Dean-Pay-Order"));
    }
}
